Loading...
 

Algorithm of hp-adaptation

The automatic hp adaptation algorithm was first described in detail in the books of prof. Leszek Demkowicz, a Polish mathematician working at the University of Texas in Austin. The analysis of the mathematical properties of the hp-adaptation Algorithm was performed by prof. Ivo Babuška, an American of Czech descent, also working at the University of Texas in Austin [1], [2], [3], [4].


  1. Algorithm for automatic hp adaptation (initial mesh, required accuracy, maximum number of iterations)
  2. coarse mesh = initial mesh
  3. loop i = 1 up to the maximum number of iterations
  4. solve a computational problem on the current coarse mesh (e.g. bitmap projection problem or heat transport problem) by obtaining a solution \( u_{h,p} \)
  5. coarse mesh = initial mesh
  6. break each coarse mesh element into 4 elements (for rectangular elements in two dimensions) or 8 elements (for cubic elements in three dimensions) (it is also possible to break triangular elements in two dimensions and tetrahedral elements, prismatic elements and pyramids in three dimensions) and increase the degree of polynomials by one in each direction on each element (which is natural for rectangular and cubic elements, but requires clarification for elements of a different type)
  7. solve a computational problem on the current fine mesh and obtain a solution \( u_{h/2,p+1} \)
  8. maximum error \( K_{max}=0 \)
  9. loop by elements \( K \) coarse mesh
  10. for each element of the coarse mesh, estimate the relative error (the norm of the difference between the solution on the coarse and fine mesh) \( K_{rel}=\| u_{h,p} - u_{h/2,p+1} \|_K = \int_K \left( u_{h,p}-u_{h/2,p+1} \right)^2 + \left( \frac{\partial u_{h,p}-u_{h/2,p+1}}{\partial x} \right)^2 + \left( \frac{\partial u_{h,p}-u_{h/2,p+1}}{\partial y} \right)^2 \)
  11. if \( K_{rel}>K_{max} \) then \( K_{max}=K_{rel} \)
  12. end of loop by elements
  13. if \( K_{max}> \) required accuracy, then it's over.
  14. loop by elements \( K \) sparse mesh
  15. if \( K_{rel}>0.33 K_{max} \) then select the optimal method of adapting the element from the coarse mesh and apply it to the element \( K \) coarse mesh
  16. end of loop through items
  17. end of iteration
Initial mesh, all elements are separated by C0 separators, base functions created by the tensor product of square polynomials in the horizontal and vertical directions are stretched on each mesh element.
Figure 1: Initial mesh, all elements are separated by C0 separators, base functions created by the tensor product of square polynomials in the horizontal and vertical directions are stretched on each mesh element.

Solution (temperature scalar field) on a sparse mesh.
Figure 2: Solution (temperature scalar field) on a sparse mesh.

The dense mesh was created by breaking each element of the sparse mesh into four elements and raising the degree of polynomials in the horizontal and vertical directions by one for each element.
Figure 3: The dense mesh was created by breaking each element of the sparse mesh into four elements and raising the degree of polynomials in the horizontal and vertical directions by one for each element.

Solution (temperature scalar field) on a dense grid.
Figure 4: Solution (temperature scalar field) on a dense grid.

Choosing the optimal adaptation strategy for each element of the sparse mesh, by comparing the solutions on the sparse and dense mesh.
Figure 5: Choosing the optimal adaptation strategy for each element of the sparse mesh, by comparing the solutions on the sparse and dense mesh.


The hp-adaptation algorithm is illustrated in Fig. 1, Fig. 2, Fig. 3, Fig. 4, Fig. 5.
The convention for drawing computational meshes is as follows. Colors in the drawings Fig. 1, Fig. 3 and Fig. 5 denote the degrees of polynomials spanning over the edges and interior of the elements. One polynomial degree is provided on each edge, while a horizontal degree and a vertical degree are provided on each interior of the element.
For example, in the picture Fig. 1 all polynomials on all edges have degree 2, and all polynomials on the inside of all elements have degree 2 in the vertical and horizontal directions. In the picture Fig. 3 all polynomials on all edges have degree 3, and all polynomials on the inside of all elements have degree 3 in the vertical and horizontal directions. See the drawing Fig. 5. When viewing elements by rows from left to right, in the first row on the first element all polynomials on the edges have degree 2, except for the polynomial on the lower edge of the element which has degree 1. On the first element the polynomials in the interior have degree 2 in the vertical and horizontal directions. On the second element, on the left, top and bottom edges, the polynomials have a degree 2, while on the inside, a degree 3 in the vertical direction and a degree 2 in the horizontal direction. On the third and fourth elements, all polynomials on the edges are of degree 3. Likewise, the polynomials in the interior in the vertical and horizontal directions. In the second row of items, the first item (i.e., the fifth global) has degree 3 polynomials on the left and right edges, and a degree 1 polynomial on the top and bottom edges. Inside, the element has degree 1 polynomials in the horizontal direction and degree 3 polynomials in the vertical direction. The second element in the second line has a polynomial degree 2 in the horizontal direction and a polynomial degree 3 in the vertical direction. On the third and fourth elements, all polynomials on all edges have degree 3, and all polynomials on the inside of all elements have degree 3 in the vertical and horizontal directions. The remaining elements in the third and fourth lines have polynomials symmetrically distributed with the polynomials in the first and second lines on the first and second elements.
What is the optimal method of adapting a single element? Note that in the case of the hp adaptation algorithm, we have many possibilities to modify a single element:

  1. Leaving the item unchanged
  2. It is possible to break an element into two new elements vertically
  3. It is possible to break an element into two new elements in the horizontal direction
  4. It is possible to break an element into four new elements (two in the horizontal direction and two in the vertical direction).

Moreover, for each broken element it is possible to modify the degree of polynomials inside the element

  1. Leave element orders unchanged
  2. It is possible to raise the order inside the element horizontally \( (p_h,p_v)\rightarrow (p_h+1,p_v) \)
  3. It is possible to raise the order inside the element in a vertical direction \( (p_h,p_v)\rightarrow (p_h,p_v+1) \)
  4. It is possible to raise the order inside the element horizontally and vertically \( (p_h,p_v)\rightarrow (p_h+1,p_v+1) \)

The orders at the edges of the modified elements are determined on the basis of the minimum rule. In other words, the degree of the polynomial at the edge divided by two adjacent elements is set as a minimum of degrees inside the elements in the appropriate direction.
For a vertical edge surrounded by two elements \( (p^1_h,p^2_v) \) and \( (p^2_h,p^2_v) \) we set the degree \( p=\textrm{min} \{ p^1_v,p^2,v\} \).
For a horizontal edge surrounded by two elements \( (p^1_h,p^2_v) \) and \( (p^2_h,p^2_v) \) we set the degree \( p=\textrm{min} \{ p^1_h,p^2,h\} \).
So we have a lot of possibilities to adapt a single element (estimating on the basis of the possible types of adaptation we have 4 (modifications of the degree of the element without breaking the element) + 4 * 4 (breaking the element into two elements in the horizontal direction and four possibilities of modifying the degree of each element) + 4 * 4 (break an element into two elements vertically and four possibilities to modify the degree of each element) + 4 * 4 * 4 * 4 (break an element into four elements and four possibilities to modify the degree of each element). A total of 4 + 4 * 4 + 4 * 4 + 4 * 4 * 4 * 4 = 292 possibilities.
How is the decision about the type of adaptation of a single element made?
The decision is made in accordance with the following Algorithm.


  1. Selecting the optimal adaptation strategy for the element \( K \) (a solution on a coarse mesh restricted to an element \( u_{h,p} \), fine mesh solution restricted to the element \( u_{h/2,p+1} \))
  2. Loop through possible types of element adaptation from 1 to 292 (represented by CODE)
  3. The fastest error decrease rate = 0
  4. Optimal adaptation = 0#Copy \( J \), element \( K \), and make the considered adaptation on it
  5. Calculate the projection \( w \) solutions on a dense mesh \( u_{h/2,p+1} \) on the element being adapted \( J \)
  6. Calculate by how much the relative error will drop if we make the adaptation represented by CODE, the error decrease rate (CODE) = \( \|u_{h/2,p+1}-u_{h,p}\|_K-\|u_{h/2,p+1}-w\|_K \)
  7. Calculate how many unknowns (how many base functions) we have to add to implement the adaptation represented by the CODE, adaptation cost (CODE)
  8. Calculate and remember the error decrease rate (CODE) = error decrease (CODE) / adaptation cost (CODE)
  9. If the error decrease rate (CODE) is greater than the fastest error decrease rate, remember the greatest error decrease rate value = error rate (CODE), OPTIMAL CODE = CODE
  10. End of the loop after possible types of adaptation (represented by CODE)
  11. Perform on element \( K \) the optimal adaptation represented by OPTIMAL CODE

In other words, we choose the type of adaptation for the element that gives the greatest error reduction at the lowest cost. This quantity is represented by the error decrease rate, which increases with the decrease in error but decreases with the cost incurred (with the number of functions added to the element because the cost of the calculation on a given element depends on the number of unknowns which are coefficients of the basis functions). This algorithm is illustrated in Fig. 6.

Selecting an optimal component adaptation strategy from a plurality of possibilities, based on the calculated error decrease rate.
Figure 6: Selecting an optimal component adaptation strategy from a plurality of possibilities, based on the calculated error decrease rate.

For the exemplary problem of heat transport in the L-shaped area, it is possible to obtain an adaptive hp mesh that allows solving the problem with the relative error of 0.0001. Such a grid is shown in Fig. 7, Fig. 8, Fig. 9, Fig. 10, Fig. 11, Fig. 12, Fig. 13.

Hp-adaptive mesh resulting in a solution of the heat transport problem over the L-shape domain with accuracy of 0.001 expressed in the relative error in H1 norm, computed between the coarse and fine mesh solution.
Figure 7: Hp-adaptive mesh resulting in a solution of the heat transport problem over the L-shape domain with accuracy of 0.001 expressed in the relative error in H1 norm, computed between the coarse and fine mesh solution.

Adaptive hp mesh allowing to solve the problem of heat transport in the L-shaped area with an accuracy of 0.001 in terms of relative error (difference in the H1 norm between the solution on a coarse mesh and a fine mesh).
Figure 8: Adaptive hp mesh allowing to solve the problem of heat transport in the L-shaped area with an accuracy of 0.001 in terms of relative error (difference in the H1 norm between the solution on a coarse mesh and a fine mesh).

Zoom 10 times towards the singularity at the central point.
Figure 9: Zoom 10 times towards the singularity at the central point.

Zoom 100 times towards the central point where the singularity is located.
Figure 10: Zoom 100 times towards the central point where the singularity is located.

Zoom 1000 times towards the central point where the singularity is located.
Figure 11: Zoom 1000 times towards the central point where the singularity is located.

Zoom 10000 times towards the central point where the singularity is located.
Figure 12: Zoom 10000 times towards the central point where the singularity is located.

Zoom 100000 times towards the central point where the singularity is located.
Figure 13: Zoom 100000 times towards the central point where the singularity is located.


The automatic hp adaptation algorithm is therefore very complicated and difficult to implement. So why is it worth our interest? Consider possible different adaptation algorithms for the exemplary L-shaped heat transport problem, i.e.

  1. A homogeneous adaptation algorithm where the number of elements is increased evenly over the entire area
  2. A homogeneous p adaptation algorithm, using a mesh made of 3 elements and increasing uniformly the degree of polynomials inside all elements horizontally and vertically, and the degree of polynomials on all edges
  3. A homogeneous p adaptation algorithm, using a grid made of 12 elements and increasing uniformly the degree of polynomials inside all elements horizontally and vertically, and the degree of polynomials on all edges
  4. An automatic p adaptation algorithm, increasing the degree of polynomials in the interiors of selected elements in selected directions, and modifying the degrees on the edges according to the minimum rule
  5. An automatic adaptation algorithm, breaking selected elements in selected directions
  6. An automatic hp adaptation algorithm, described in this chapter

If we draw a graph of the convergence of these algorithms in such a way that on the horizontal axis we place the size of the grid understood as the number of basis functions on the entire grid, which corresponds to the number of unknown coefficients of these basis functions, i.e. the size of the matrix of the system of equations to be solved, and on the vertical axis, the relative error calculated in H1 standard between the solution on the coarse mesh and the dense mesh
\( \|u_{h,p}-u_{h/2,p+1}\|_{H^1}=\frac{\int_{\Omega} (u_{h,p}-u_{h/2,p+1})^2+(\frac{\partial (u_{h,p}-u_{h/2,p+1}}{\partial x})^2+(\frac{\partial (u_{h,p}-u_{h/2,p+1}}{\partial x})^2 }{\int_{\Omega} (u_{h/2,p+1})^2+(\frac{\partial (u_{h/2,p+1}}{\partial x})^2+(\frac{\partial (u_{h/2,p+1}}{\partial x})^2 } \)
then it turns out that only the automatic hp adaptation algorithm has the feature of exponential convergence. It is definitely the fastest and can solve a given computational problem with an accuracy that is impossible to achieve by other adaptive algorithms.

Convergence of various adaptive algorithms.
Figure 14: Convergence of various adaptive algorithms.

then it turns out that only the automatic hp adaptation algorithm has the feature of exponential convergence. It is definitely the fastest and can solve a given computational problem with an accuracy that is impossible to achieve by other adaptive algorithms.
In practice, most engineering problems require accuracy in the range of 5 percent and square polynomials. However, there are computational tasks where high accuracy of the solution is essential. Examples of such computational tasks are, for example, simulations of flows around the wings of aircraft, which require very high accuracy in the boundary layer on the wings of the aircraft, or simulations of the propagation of electromagnetic waves in the geological formation layers to identify oil deposits that require very high accuracy in the vicinity of the receiver antenna.


Ostatnio zmieniona Piątek 08 z Październik, 2021 09:09:11 UTC Autor: Maciej Paszynski
Zaloguj się/Zarejestruj w OPEN AGH e-podręczniki
Czy masz już hasło?

Hasło powinno mieć przynajmniej 8 znaków, litery i cyfry oraz co najmniej jeden znak specjalny.

Przypominanie hasła

Wprowadź swój adres e-mail, abyśmy mogli przesłać Ci informację o nowym haśle.
Dziękujemy za rejestrację!
Na wskazany w rejestracji adres został wysłany e-mail z linkiem aktywacyjnym.
Wprowadzone hasło/login są błędne.